package org.yenn.pattern.aliyun.structural.decorator;

import org.junit.Test;
import org.yenn.pattern.aliyun.service.Shape;
import org.yenn.pattern.aliyun.service.impl.Circle;
import org.yenn.pattern.aliyun.service.impl.Rectangle;

import static org.junit.Assert.*;

/**
 * 步骤 5
 * 使用 RedShapeDecorator 来装饰 Shape 对象。
 */
public class DecoratorPatternDemo {
    /**
     * 步骤 6
     * 验证输出。
     * Circle with normal border
     * Inside Circle::draw() method.
     *
     * Circle of red border
     * Inside Circle::draw() method.
     * Border Color: Red
     *
     * Rectangle of red border
     * Inside Rectangle::draw() method.
     * Border Color: Red
     */
    @Test
    public void draw() {
        Shape circle = new Circle();
        System.out.println("Circle with normal border");
        circle.draw();


        Shape redCircle = new RedShapeDecorator(new Circle());
        System.out.println("\nCircle of red border");
        redCircle.draw();


        Shape redRectangle = new RedShapeDecorator(new Rectangle());
        System.out.println("\nRectangle of red border");
        redRectangle.draw();




    }
}